/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.core.multithreading;

public class MyThread extends Thread {

  String word;

  public MyThread(String rm){
    word = rm;
  }

  public void run(){

    try {
    
      for(;;){
        System.out.println(word);
        Thread.sleep(1000);
      }
    
    } catch(InterruptedException e) {

      System.out.println("sleep intreupted");      
    }
  }

  public static void main(String[] args) {

    Thread t1=new MyThread("First Thread");
    Thread t2=new MyThread("Second Thread");
    t1.start();
    t2.start();
  }
}